﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using GrapeCity.ActiveReports;

namespace ActiveReportsDemo.Viewers
{
    public partial class AnnotationViewer : DemoBaseUserControl
    {
        public AnnotationViewer()
        {
            InitializeComponent();
        }

        public override void ShowReport()
        {
            ReportViewer.AnnotationDropDownVisible = true;
            
            switch (CurrentReportName)
            {
                case "rptDownAcrossWithGroup.rpt":
        
                    ReportViewer.Document.Load(@"Data\物品清单.rdf");
                    break;
                default:
                    break;
            }
        }
        private void AnnotationViewer_Load(object sender, EventArgs e)
        {
            
        }

        private void CreatePageReport(string name)
        {
            PageReport page1 = new PageReport(new System.IO.FileInfo(string.Format(@"Reports\{0}.rdlx", name)));
            GrapeCity.ActiveReports.Document.PageDocument document1 = new GrapeCity.ActiveReports.Document.PageDocument(page1);
            ReportViewer.LoadDocument(document1);
        }

        private void btnOpen_Click(object sender, EventArgs e)
        {
            OpenFileDialog dlgOpen = new OpenFileDialog();
            dlgOpen.Filter = "*.rdf|*.rdf";
            if (dlgOpen.ShowDialog() == DialogResult.OK)
            {
                ReportViewer.Document.Load(dlgOpen.FileName);
            }
        }

        private void btnSave_Click(object sender, EventArgs e)
        {
            SaveFileDialog dlgSave = new SaveFileDialog();
            dlgSave.Filter = "*.rdf|*.rdf";
            if (dlgSave.ShowDialog() == DialogResult.OK)
            {
                ReportViewer.Document.Save(dlgSave.FileName);
            }
        }
    }
}
